package com.example.ems.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter("/*")
public class EncodingFilter implements Filter {
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
            throws IOException, ServletException {
        request.setCharacterEncoding("UTF-8");
        response.setCharacterEncoding("UTF-8");
        // response.setContentType("text/html;charset=UTF-8"); // Set in JSPs or Servlets if needed
        chain.doFilter(request, response);
    }
    public void init(FilterConfig filterConfig) {}
    public void destroy() {}
}
